package cn.hznc.controller.analysis;

import cn.hznc.controller.service.analysis.ToolAnalysisService;
import cn.hznc.domain.request.analysis.MacToolAnalysisReq;
import cn.hznc.domain.request.analysis.ToolTypeAnalysisReq;
import cn.hznc.domain.request.inventory.LocationToolDetailReq;
import cn.hznc.domain.response.ResponseBody;
import cn.hznc.exception.ToolLifeCycleException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * @Author：Administrator
 * @Date：2023/6/28 14:59
 */
@RestController
@Slf4j
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/toolAnalysis")
public class ToolAnalysisController {

    @Autowired
    private ToolAnalysisService toolAnalysisService;

    /**
     * 刀具库存情况分析
     * @param ToolTypeAnalysisReq
     * @return
     */
    @RequestMapping(value = "/toolTypeAnalysis", method = RequestMethod.POST)
    public ResponseBody toolTypeAnalysis(@RequestBody ToolTypeAnalysisReq ToolTypeAnalysisReq) {
        try {
            return ResponseBody.success(toolAnalysisService.toolTypeAnalysis(ToolTypeAnalysisReq));
        } catch (ParseException e) {
            log.error(e.getMessage());
            return ResponseBody.error("10002","数据有误");
        }
    }


//    /**
//     * 机床刀具使用分析
//     * @param macToolAnalysisReq
//     * @return
//     */
//    @RequestMapping(value = "/macToolAnalysis", method = RequestMethod.POST)
//    public ResponseBody macToolAnalysis(@RequestBody MacToolAnalysisReq macToolAnalysisReq) {
//        try {
//            return ResponseBody.success(toolAnalysisService.macToolAnalysis(macToolAnalysisReq));
//        } catch (ParseException e) {
//            log.error(e.getMessage());
//            return ResponseBody.error("10002","数据有误");
//        }
//    }
}
